package com.yiyi.credit.manage.sso.model.dto.response;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.yiyi.credit.manage.sso.common.exception.ResponseCode;

import java.io.Serializable;


@JsonInclude(JsonInclude.Include.NON_NULL)
public class Response<T> implements Serializable {

    private static final long serialVersionUID = 355207958304927788L;

    private String code = "10000"; // 状态码

    private String message = "success"; // 异常消息

    private T result; // 数据

    private Long timestamp = System.currentTimeMillis();

    public Response() {

    }

    public Response(ResponseCode code) {
        this.code = code.getCode();
        this.message = code.getMessage();
    }

    public Response(String code, String message) {
        this.code = code; //
        this.message = message;
    }

    public Response(T result) {
        this.result = result;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public T getResult() {
        return result;
    }

    public void setResult(T result) {
        this.result = result;
    }

    public Long getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(Long timestamp) {
        this.timestamp = timestamp;
    }

}
